package com.wheesper.www.WheesperServer.Bootstrap;

import com.wheesper.www.WheesperServer.Common.Request;
import com.wheesper.www.WheesperServer.Common.RequestDispatcher;
import com.wheesper.www.WheesperServer.Common.TaskQueue;
import com.wheesper.www.WheesperServer.Net.Base.WheesperServer;


class NetworkIORunnable implements Runnable{
	private TaskQueue<Request> _taskqueue;
	public NetworkIORunnable(TaskQueue<Request> que) {
		_taskqueue = que;
	}
	
	@Override
	public void run() {
		WheesperServer server = new WheesperServer(12345, _taskqueue);
		try {
			server.start();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}

public class Bootstrap {
	public static void main(String[] args) throws Exception {
		TaskQueue<Request> messageQueue = new TaskQueue<Request>();
		RequestDispatcher dispatcher = new RequestDispatcher(messageQueue);
		new Thread(new NetworkIORunnable(messageQueue)).start();
		dispatcher.dispacthing();
	}
}
